#课程模块接口封装：核心在于依据接口文档实现接口信息封装、重点关注接口如何被调用
import requests
import config
class CourseAPI:
    def __init__(self):
        self.url_add_course = config.BASE_URL+"/api/clues/course"
        self.url_select_course = config.BASE_URL+"/api/clues/course/list"

    def add_course(self,test_data,token):
        return requests.post(url = self.url_add_course,json=test_data,headers={"Authorization":token})
    #查询课程
    def select_course(self,test_data,token):
        return requests.get(url=self.url_select_course + f"/{test_data}",headers={"Authorization":token})
    #课程修改
    def update_course(self,test_data,token):
        return requests.put(url=self.url_add_course,json =test_data,headers={"Authorization":token})
    #删除
    def delete_course(self,course_id,token):
        return requests.delete(url=self.url_add_course + f"/{course_id}",headers={"Authorization":token})